;Patrick Tessier
;1200x1600
; This file contains method to help user to design tests
#include-once
#include <MWSnapExec.au3>
$PaletteButtonx=1500; X to select element in a palette
$PaletteChangex=1588; x to change the palette item
$shoot=0
; select a element in the subpalette
Func selectElement($toolBox,$value)
	MouseMove($PaletteChangex,$toolBox)
	MouseDown("left")
	MouseUp("left")
	Sleep(500)
	MouseMove($PaletteButtonx,$value)
	MouseDown("left")
	MouseUp("left")
EndFunc

;test the creation of an element
Func TestElementCreation($posButtonY,$PosX,$PosY)
	Opt("WinWaitDelay",100)
	Opt("WinTitleMatchMode",4)
	Opt("WinDetectHiddenText",1)
	Opt("MouseCoordMode",0)
	WinWait("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	If Not WinActive("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a") Then WinActivate("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	WinWaitActive("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	MouseMove($PaletteButtonx,$posButtonY)
	MouseDown("left")
	MouseUp("left")
	MouseMove($PosX,$PosY)
	MouseDown("left")
	MouseUp("left")
EndFunc


; test CTR-Z
Func controlZ()
	WinWait("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	If Not WinActive("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a") Then WinActivate("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	WinWaitActive("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	Sleep(1000)
	Send("{CTRLDOWN}z{CTRLUP}")
	Sleep(1000)
EndFunc


; TEST CTR-Y
Func controlY()
	WinWait("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	If Not WinActive("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a") Then WinActivate("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	WinWaitActive("Papyrus - umlExample1.di2 - Eclipse SDK","An overview is not a")
	Sleep(1000)
	Send("{CTRLDOWN}y{CTRLUP}")
	Sleep(1000)
EndFunc

; test graphical deletion
Func TestGraphicalDeletion($PosX,$PosY)
	WinWait("Papyrus - umlExample1.di2 - Eclipse SDK","")
	If Not WinActive("Papyrus - umlExample1.di2 - Eclipse SDK","") Then WinActivate("Papyrus - umlExample1.di2 - Eclipse SDK","")
	WinWaitActive("Papyrus - umlExample1.di2 - Eclipse SDK","")
	MouseMove($PosX,$PosY)
	MouseDown("right")
	MouseUp("right")
	Sleep(500)
	MouseMove($PosX+100,$PosY+140)
	MouseDown("left")
	MouseUp("left")
EndFunc

;test deletion
Func TestDeletion($PosX,$PosY)
	WinWait("Papyrus - umlExample1.di2 - Eclipse SDK","")
	If Not WinActive("Papyrus - umlExample1.di2 - Eclipse SDK","") Then WinActivate("Papyrus - umlExample1.di2 - Eclipse SDK","")
	winWaitActive("Papyrus - umlExample1.di2 - Eclipse SDK","")
	MouseMove($PosX,$PosY)
	MouseDown("right")
	MouseUp("right")
	Sleep(500)
	MouseMove($PosX+100,$PosY+120)
	MouseDown("left")
	MouseUp("left")
EndFunc


;test Resize
Func TestRezise($PosX,$PosY)
	WinWait("Papyrus - umlExample1.di2 - Eclipse SDK","")
	If Not WinActive("Papyrus - umlExample1.di2 - Eclipse SDK","") Then WinActivate("Papyrus - umlExample1.di2 - Eclipse SDK","")
	WinWaitActive("Papyrus - umlExample1.di2 - Eclipse SDK","")
	MouseMove($PosX,$PosY)
	MouseDown("right")
	MouseUp("right")
	Sleep(500)
	MouseMove($PosX+100,$PosY+165)
	MouseDown("left")
	MouseUp("left")
EndFunc

; to take a picture
Func shoot()
	if ($shoot==1)Then
		Sleep(3000)
		MWSnapShoot()
		Sleep(2000)
	EndIf
EndFunc
